package artid.com.arttogo.bean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;

public class ArtNewsCate extends AppItem implements Serializable {
	ArrayList<channel> listitemAll;
	ArrayList<channel> listItemMy;

	public ArrayList<channel> getListitemAll() {
		return listitemAll;
	}

	public void setListitemAll(ArrayList<channel> listitemAll) {
		this.listitemAll = listitemAll;
	}

	public ArrayList<channel> getListItemMy() {
		return listItemMy;
	}

	public void setListItemMy(ArrayList<channel> listItemMy) {
		this.listItemMy = listItemMy;
	}

	@Override
	public void parse(JSONObject obj) {
		if (null == obj) {
			return;
		}
		listitemAll = new ArrayList<channel>();
		JSONArray array = obj.optJSONArray("allchannel");
		if (array != null) {
			for (int i = 0; i < array.length(); i++) {
				JSONObject jsitem = array.optJSONObject(i);
				channel item = new channel();
				item.setId(jsitem.optString("id"));
				item.setTitle(jsitem.optString("title"));
				listitemAll.add(item);
			}
		}
		listItemMy = new ArrayList<channel>();
		JSONArray arraymy = obj.optJSONArray("mychannel");
		if (arraymy != null) {
			for (int i = 0; i < arraymy.length(); i++) {
				JSONObject jsitem = arraymy.optJSONObject(i);
				channel item = new channel();
				item.setId(jsitem.optString("id"));
				item.setTitle(jsitem.optString("title"));
				listItemMy.add(item);
			}
		}

	}

	public class channel {
		String id;
		String title;

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

	}

}
